<template>
  <div>
    <div class="fastRegister">
      <div>
        <el-form ref="form" label-width="100px" class="demo-ruleForm">
          <el-form-item label="企业名称">
            <el-input
              v-model="form.name"
              size="mini"
              placeholder="请填写工商营业执照上的企业全称"
            ></el-input>
            <div style="color: #9797a1; font-size: 12px">
              企业名称需与工商部门登记信息一致
            </div>
          </el-form-item>
          <el-form-item label="证件类型">
            <el-select
              v-model="form.codeType"
              placeholder="请选择企业证件类型"
              size="small"
              class="input-rule"
              style="width: 300px"
            >
              <el-option
                v-for="(item, index) in enterprise"
                :key="index"
                :label="item.codeName"
                :value="item.codeType"
              />
            </el-select>
          </el-form-item>
          <el-form-item label="企业代码" >
            <el-input
              v-model="form.code"
              size="mini"
              placeholder="请填写企业代码"
            ></el-input>
          </el-form-item>
		  <el-form-item label="法人姓名">
		    <el-input
		      v-model="form.legalPersonaName"
		      size="mini"
		      placeholder="请填写法人姓名"
		    ></el-input>
		    <div style="color: #9797a1; font-size: 12px">
		      法人姓名需与绑定微信银行卡的姓名一致
		    </div>
		  </el-form-item>
		  <el-form-item label="法人微信">
		    <el-input
		      v-model="form.legalPersonaWechat"
		      size="mini"
		      placeholder="请填写法人微信号"
		    ></el-input>
		    <div style="color: #9797a1; font-size: 12px">
		      需使用绑定法人银行卡号的微信号
		    </div>
		  </el-form-item>
        </el-form>
      </div>
    </div>
    <div class="bottom">
      <el-button
        style="color: #fff"
        type="primary"
        @click="determine"
        >提交申请</el-button
      >
      <el-button @click="cancel">取消</el-button>
    </div>
  </div>
</template>
<script>
import { registerApplet } from "@/api/applet/authorization";
export default {
  data() {
    return {
      form: {},
      enterprise: [
        {
          codeType: "1",
          codeName: "统一社会信用代码",
        },
        {
          codeType: "2",
          codeName: "组织机构代码",
        },
        {
          codeType: "3",
          codeName: "营业执照注册号",
        },
      ],
    };
  },
  methods: {
    determine() {
        console.log(this.form);
      registerApplet(this.form).then((response) => {
        if (response == 0) {
          this.msgSuccess("创建成功");
        }else if(response == 89249){
          this.msgError("该主体已有任务执行中，距上次任s务 24h 后再试");
        }else {
          this.msgError("输入有误");
        }
      });
    },
    cancel() {
      this.$router.push("/register/data/");
    },
  },
};
</script>
<style lang="scss" scoped>
.fastRegister {
  background: #ffffff;
  width: 1000px;
  height: auto;
  padding: 80px 30px 50px;
  border-radius: 10px;
  border: 1px solid #eee;
  margin: 50px auto 0;
}
.el-input {
  width: 300px;
}
.bottom {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 68px;
  padding-left: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #fff;
  box-shadow: 0 -3px 5px #eee;
  z-index: 1;
}
</style>
